package game.model.objets;

import game.Utils;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.ImageIcon;

/**
 *
 * @author Gab'z
 */
public abstract class PNJ extends ElementJeu {

    private String nom;
    private String prenom;
    private ImageIcon imgPortrait;

    public PNJ(String idPlan, String prenom, String nom, String description, boolean isActif, int posX, int posY) {
        super(idPlan, description, isActif, posX, posY);

        this.prenom = prenom;
        this.nom = nom;
        System.out.println("+ PNJ : " + id);
        if (Utils.mode == Utils.LOCAL) {
            this.imgJeu = new ImageIcon(Utils.baseURLlocal + "pnj\\" + id + Utils.format_img);
            this.imgPortrait = new ImageIcon(Utils.baseURLlocal + "pnj\\" + id + "_i" + Utils.format_img);
        } else {
            try {
                this.imgJeu = new ImageIcon(new URL(Utils.baseURL + "pnj/" + id + Utils.format_img));
                this.imgPortrait = new ImageIcon(new URL(Utils.baseURL + "pnj/" + id + "_i" + Utils.format_img));
            } catch (MalformedURLException ex) {
                System.err.println("Erreur lors de la récupération de l'image du PNJ d'id : " + id);
            }
        }

    }

    public ImageIcon getImgPortrait() {
        return imgPortrait;
    }

    public String getNom() {
        return nom;
    }

    public String getPrenom() {
        return prenom;
    }
}
